//
//  BaseViewController.m
//  YAMainProject
//
//  Created by 郑逸凯 on 2018/9/21.
//  Copyright © 2018年 郑逸凯. All rights reserved.
//

#import "BaseViewController.h"
#import <IQKeyboardManager/IQKeyboardManager.h>

@interface BaseViewController ()

@end

@implementation BaseViewController
#pragma mark - Life Cycle

- (void)setupPageData:(NSDictionary *)pageData {
    _pageData = pageData;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:RGB16(0x333333)}];
    self.navigationController.navigationBar.barTintColor =  [UIColor whiteColor];
    self.navigationController.navigationBar.tintColor = RGB16(0x333333);
    self.navigationController.navigationBar.translucent = YES;
    // Do any additional setup after loading the view.
    [self setDefaultNaviBackButtom];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (BOOL)shouldAutorotate{        //需要支持旋转屏幕
    return YES;    //默认YES
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskPortrait;    //不希望屏幕自动旋转，通过这里控制，有时会失效。

}





#pragma mark - Public Methods

- (void)setIQKeyboardEnable:(BOOL)enable {
    [IQKeyboardManager sharedManager].enable = enable;
}

- (void)setDefaultNaviBackButtom {
//    UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"navi_back"] style:UIBarButtonItemStylePlain target:self action:@selector(backAction)];
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(0, 0, 40, 40);
    [button setImage:[UIImage imageNamed:@"navi_back"] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:button];
    self.navigationItem.backBarButtonItem = backItem;
}

#pragma mark - Responder Actions
- (void)backAction {
    [self.navigationController popViewControllerAnimated:YES];
}

#pragma mark - Delegates
#pragma mark - Private Methods
#pragma mark - Setters and Getters
#pragma mark - Helper



@end
